class Solution {
public:
    int minPairSum(vector<int>& nums) {
        sort(nums.begin(), nums.end());
        int n = nums.size();
        vector<int> group((n + 1) >> 1, 0);
        int ret = 0;
        for(int i = 0, j = n - 1; i < n >> 1; ++i, --j)
        {
            group[i] = nums[i] + nums[j];
            ret = max(ret, group[i]);
        }
        return ret;
    }
};
